﻿// Copyright (c) 2014 Jonathan Magnan (http://jonathanmagnan.com/).
// All rights reserved (http://zzzproject.com/sqlbulkcopy-extensions/).
// Licensed under MIT License (MIT) (https://zsqlbulkcopy.codeplex.com/license/).
using System.Collections.Generic;
using System.Data;

namespace Z.Net.Extensions
{
    internal partial class SqlBulkOperation
    {
        public bool HasRow()
        {
            if (DataSource is DataTable)
            {
                return ((DataTable) DataSource).Rows.Count != 0;
            }
            if (DataSource is DataRow[])
            {
                return ((DataRow[]) DataSource).Length != 0;
            }
            if (DataSource is IEnumerable<object>)
            {
                return DataSourceAsList.Count != 0;
            }
            return true;
        }
    }
}